// 系统托盘
import { app, BrowserWindow } from "electron";
import { APP_ICON_PATH } from "@/settings";

// import { openFile, openPath, ipcMarkdownWindow, ipcSketchWindow, ipcMindmapWindow } from '../associations/fs_manager';

import { getMainWindow } from "@/jc-electron-tools/windows";
import { MenuOptions } from "@/jc-electron-tools/types";
import { createTray } from "@/jc-electron-tools/tray";

const options: MenuOptions = [
    {
        label: "显示主界面",
        click: () => {
            const mainWindow = getMainWindow();
            mainWindow.show();
        },
    },
    {
        label: "最小化到托盘",
        click: () => {
            const wins = BrowserWindow.getAllWindows();
            for (const win of wins) {
                win.hide();
            }
        },
    },
    { type: "separator" },
    {
        label: "意见反馈",
        click: () => {},
    },
    {
        label: "检查更新",
        click: () => {},
    },
    { type: "separator" },
    {
        label: "退出应用",
        click: () => {
            app.quit();
        },
    },
];

function createTrayIcon() {
    return createTray(APP_ICON_PATH, options);
}

export { createTrayIcon };
